subroutine fae_t2famn_ifemn(fae, t2, iabij, icore, fact)
!
use mod_ioff
use mod_orbit
use mod_iop 
use mod_size
implicit none
!
real*8, intent(in) :: fact
real*4, intent(in) :: fae(*)
!
real*4, intent(inout) :: t2(*), iabij(*), icore(*)
!
integer :: i, j, a, b, nsize, i0, i1, i2
integer, external :: idsymsoc, irpdso
real*8, external :: dnrm2
!this is to do fae = fia -0.5*t2(mn,fa)*<mn|fe>
i0 = 1
i1 = i0 + nvvoo*isd
i2 = i1 + nvvoo*isd
!----t2(MN,FA)*<MN|FE> 
call itranspso(iabij(ioi3(1)), icore(i2), vrta, vrta, 0, popa, popa, 0, 1)
call iexpso(icore(i2), icore(i0), popa, popa, 0, 0, vrta, vrta, 0, 1, 1) 
!
call itranspso(t2(ioi3(1)), icore(i2), vrta, vrta, 0, popa, popa, 0, 1)
call iexpso(icore(i2), icore(i1), popa, popa, 0, 0, vrta, vrta, 0, 1, 1) 
!
call VpqrmVpqrn_to_Vmn(icore(i1), icore, 1, 1, popa, popa, 0, vrta, vrta, vrta, &
                fae(ifvv(1)), 1, fact*2.d0)
!----t2(Mn,Fa)*<Mn||Fe>
call itranspso(t2(ioi3(2)), icore(i1), vrta, vrtb, 1, popa, popb, 1, 1)
call itranspso(iabij(ioi3(2)), icore(i2), vrta, vrtb, 1, popa, popb, 1, 1)
call VpqrmVpqrn_to_Vmn(icore(i1), icore(i2), 1, 1, popa, popb, 1, vrta, vrtb, vrtb, &
                fae(ifvv(2)), 1, fact*2.d0)
!----t2(mN,fA)*<mN|fE> = t2(Nm,Af)*<Nm|Ef>
call isymtrso(icore(i1), icore(i0), popa, popb, 1, 0, vrta, vrtb, 1, 1, 1) 
call isymtrso(icore(i2), icore(i1), popa, popb, 1, 0, vrta, vrtb, 1, 1, 1) 
call VpqrmVpqrn_to_Vmn(icore(i0), icore(i1), 1, 1, popa, popb, 1, vrtb, vrta, vrta, &
                fae(ifvv(1)), 1, fact*2.d0)
!----t2(mn,fa)*<mn||fe>
call itranspso(iabij(ioi3(3)), icore(i2), vrtb, vrtb, 0, popb, popb, 0, 1)
call iexpso(icore(i2), icore(i0), popb, popb, 0, 0, vrtb, vrtb, 0, 1, 1) 
!
call itranspso(t2(ioi3(3)), icore(i2), vrtb, vrtb, 0, popb, popb, 0, 1)
call iexpso(icore(i2), icore(i1), popb, popb, 0, 0, vrtb, vrtb, 0, 1, 1) 
!
call VpqrmVpqrn_to_Vmn(icore(i1), icore, 1, 1, popb, popb, 0, vrtb, vrtb, vrtb, &
                fae(ifvv(2)), 1, fact*2.d0)
return
end
